#include <stdio.h>
#include <stdlib.h>

typedef int DataType;
struct Node {
    DataType data;
    struct Node *next;
};
typedef struct Node *PNode;
typedef struct Node *LinkStack;

LinkStack SetNullStack_Link()  
{
    LinkStack top = (LinkStack)malloc(sizeof(struct Node));
    if (top != NULL) top->next = NULL;
    else printf("Alloc failure");
    return top;  
}

int IsNullStack_link(LinkStack top) 
{
    if (top->next == NULL)
        return 1;
    else
        return 0;
}

void Push_link(LinkStack top, DataType x) 
{
    PNode p;
    p = (PNode)malloc(sizeof(struct Node));
    if (p == NULL)
        printf("Alloc failure");
    else
    {
        p->data = x;
        p->next = top->next;
        top->next = p;
    }
}
void Pop_link(LinkStack top)
{
    PNode p;
    if (top->next == NULL)
        printf("it is empty stack!");
    else
    {
        p = top->next;
        top->next = p->next;
        free(p);
    }
}
DataType Top_link(LinkStack top)
{
    if (top->next == NULL)
    {
        printf("It is empty stack!");
        return 0;
    }
    else
        return top->next->data;
}
void BracketMatch(LinkStack top)
{
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch == '#') break;
        if(ch == '('){
            Push_link(top,1);
        }else{
            int now = Top_link(top);
            if(now != 1){
                printf("no!");
                return;
            }else Pop_link(top);
        }
    }
    if(IsNullStack_link(top)) printf("yes!");
    else printf("no!");
}
int main()
{
    LinkStack mystack = NULL;
    mystack = SetNullStack_Link();
    BracketMatch(mystack);
    return 0;
}
